package com.colorful.insuranceproject.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.colorful.insuranceproject.R;
import com.colorful.insuranceproject.bean.PhysicalExaminationAppointmentBean;
import com.lovely3x.common.adapter.BaseViewHolder;
import com.lovely3x.common.adapter.ListAdapter;

import java.util.List;

import butterknife.Bind;

/**
 * Created by handsome-Bob on 2017/10/27.
 * <p>
 * 体检预约的适配器
 */
public class PhysicalExaminationAppointmentAdapter extends ListAdapter<PhysicalExaminationAppointmentBean> {
    public PhysicalExaminationAppointmentAdapter(List<PhysicalExaminationAppointmentBean> datas, Context context) {
        super(datas, context);
    }

    @NonNull
    @Override
    public BaseViewHolder createViewHolder(int position, ViewGroup parent) {
        return new ViewHolder(getLayoutInflater().inflate(R.layout.item_p_e_a, parent, false));
    }

    @Override
    public void handleData(int position, @NonNull BaseViewHolder holder) {
        ViewHolder viewHolder = (ViewHolder) holder;
        PhysicalExaminationAppointmentBean bean = datas.get(position);

        viewHolder.tvName.setText(bean.getTitle());

        viewHolder.tvMoney.setText(bean.getPrice() + bean.getUnit());
    }

    class ViewHolder extends BaseViewHolder {

        @Bind(R.id.tv_name)
        TextView tvName;

        @Bind(R.id.tv_money)
        TextView tvMoney;

        public ViewHolder(View rootView) {
            super(rootView);
        }
    }
}
